package net.bw.realtime.tmall.ods.utils;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Month;
import java.time.ZoneId;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

public class RandomTimestampToday {
    public long getRandomTimestampToday() {

        // 设置双十一日期（2023年11月11日）
        LocalDateTime startOfDay = LocalDateTime.of(2016, Month.NOVEMBER, 11, 0, 0, 0);
        LocalDateTime endOfDay = LocalDateTime.of(2016, Month.NOVEMBER, 11, 23, 59, 59);

        // 转换为时间戳（毫秒）
        long startMillis = startOfDay.atZone(ZoneId.of("Asia/Shanghai")).toInstant().toEpochMilli();
        long endMillis = endOfDay.atZone(ZoneId.of("Asia/Shanghai")).toInstant().toEpochMilli();

        // 生成该范围内的随机时间戳
        return ThreadLocalRandom.current().nextLong(startMillis, endMillis);
    }
}
